package com.ktjy.utils;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class Single {
    private static Single single;
    private static Properties properties;
    private Single() {
        String configFile = "database.properties";
        properties = new Properties();
        InputStream is = Single.class.getClassLoader().getResourceAsStream(configFile);
        try {
            properties.load(is);
            is.close();
        } catch (IOException e) {
           e.printStackTrace();
        }
    }
    public static class SingleHelper {
        private static final Single INSTANCE = new Single();
    }
    public static Single getInstance() {
        single = SingleHelper.INSTANCE;
        return single;
    }
    public String getValue(String key) {
        return properties.getProperty(key);
    }
    public static Single test(){
        return single;
    }
}
